package com.xnfh.equipment.viewmodel

import com.xnfh.common.bean.KcBean
import com.xnfh.framework.base.BaseViewModel
import com.xnfh.framework.bean.RespStateData
import org.json.JSONObject

/**
 * @Description:
 * @Author: ziheng
 * @CreateDate: 2023/12/25 13:46
 * @UpdateUser: ziheng
 * @UpdateDate: 2023/12/25 13:46
 * @UpdateRemark: 更新说明
 */
class KcEquipmentViewModel: BaseViewModel() {

    private val kcEquipmentViewModelRes = KcEquipmentViewModelRes()
    val kvList = RespStateData<KcBean>()

    /**
     * 获取设备列表
     */
    fun requestKcList(keyWord:String? = null,page: Int) = launch {
        val jsonObject = JSONObject()
        keyWord?.let {
            jsonObject.put("gatewayname",it)
        }
        jsonObject.put("current",page)
        jsonObject.put("size",20)
        kcEquipmentViewModelRes.requestKcList(creatRequestBody(jsonObject.toString()),kvList)
    }

}